package com.zh.oauth.aop;

import com.zh.oauth.service.ElecUserService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import com.zh.common.entity.JSONResult;

import javax.validation.constraints.NotNull;

/**
 * code is far away from bug with the animal protecting
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃代码无BUG！
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 *
 * @Description: 绑定属性日志记录
 * @Author: Li.HuiNeng
 * @Create in: 2020/6/6 11:40
 * @Version: 1.0.1
 */
@Component
@Aspect
public class BindLog {

    private static final Logger log = LoggerFactory.getLogger(AuthLog.class);

    @Qualifier("taskExecutor")
    @Autowired
    private TaskExecutor executor;

    @Autowired
    private MongoTemplate mongoTemplate;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private ElecUserService userService;

/*    @Pointcut("execution(* com.zh.oauth.controller.AuthController.bindRoleAc(..))")
    public void bindAttrLog(){}

    @AfterReturning(value = "bindAttrLog()", returning = "result")
    public void afterBindAttrLog(@NotNull JoinPoint jp, JSONResult result) {
        executor.execute(new Runnable() {
            @Override
            public void run() {

            }
        });
    }*/
}
